---
sidebar_position: 5
---

# Ref

See how to use a ref to [control the grid from a parent](../controlling-the-grid).

## Reading values
### activeCell
> Type: `{ colId?: string, col: number, row: number } | null`

The active / highlighted cell or null if no cell is active. `col` is the index of the column and `colId` is its [`id`](columns#id)
if it is specified.

### selection
> Type: `{ min: Cell, max: Cell } | null`

The current selection rect or null if nothing is selected or active. `min` and `max` are of the same type as `activeCell`.

## Writing values
### setActiveCell
> Type: `(activeCell: { col: number | string, row: number } | null) => void`

Set the current active cell, pass null to  blur the grid. The column can be specified using its index (a number) or its [`id`](columns#id) (a string).

### setSelection
> Type: `(selection: { min: Cell, max: Cell } | null) => void`

Set the current selection, pass null to  blur the grid. `min` and `max` are of the same type as `setActiveCell`.
